﻿using System;
using System.Collections.Generic;
using System.Resources;
using CuteSprite.Eme.UI.Settlement.Localization.Internal;
using HmFramework.Localization;
using HmFramework.Localization.Internal;

namespace CuteSprite.Eme.UI.Settlement
{
	#region -- UIIMStringId --

	public enum UIIMStringId
	{
	}

	#endregion

	#region -- UIIMLocalizer --

	public class UIIMLocalizer : UIIMLocalizerBase<UIIMStringId>
	{
		static UIIMLocalizer()
		{
			SetActiveLocalizerProvider(new DefaultActiveLocalizerProvider<UIIMStringId>(CreateDefaultLocalizer()));
		}

		#region - PopulateStringTable -

		protected override void PopulateStringTable()
		{
			//AddString(UIIMStringId.FrmMain_Caption_From, "CuteSprite MIS Server Administration Access Configurator");
		}

		#endregion

		public static HmLocalizer<UIIMStringId> CreateDefaultLocalizer()
		{
			return new UIIMResLocalizer();
		}

		public static String GetString(UIIMStringId id)
		{
			return Active.GetLocalizedString(id);
		}

		public static String GetString(String id)
		{
			return GetString((UIIMStringId)Enum.Parse(typeof(UIIMStringId), id, true));
		}

		public override HmLocalizer<UIIMStringId> CreateResXLocalizer()
		{
			return new UIIMResLocalizer();
		}
	}

	#endregion

	#region -- UIIMResLocalizer --

	public class UIIMResLocalizer : HmResXLocalizer<UIIMStringId>
	{
		public UIIMResLocalizer()
			: base(new UIIMLocalizer())
		{
		}

		protected override ResourceManager CreateResourceManagerCore()
		{
			return new ResourceManager(typeof(UIIMResLocalizer).Namespace + ".LocalizationRes", typeof(UIIMResLocalizer).Assembly);
		}
	}

	#endregion
}

namespace CuteSprite.Eme.UI.Settlement.Localization.Internal
{
	public abstract class UIIMLocalizerBase<T> : HmLocalizer<T> where T : struct
	{
		protected override void AddString(T id, String str)
		{
			Dictionary<T, String> table = HmLocalizierHelper<T>.GetStringTable(this);
			table[id] = str;
		}
	}
}